import request from "@/utils/request.ts";
import type {SysResponse} from "@/api/commonType.ts";
import type {RoleDictionary} from "@/api/role/type.ts";

export enum API {

  GET_ROLES = "/api/role/list",
  GET_CURRENT_ROLE = "api/role/current"
}


/**
 * 获取角色字典
 */
export function getRolesDic() {
  return request.get<string, SysResponse<RoleDictionary[]>>(API.GET_ROLES)
}

/**
 * 获取当前用户在家庭中的角色
 * @param familyId
 */
export function getCurrentRole(familyId: number) {
  return request.get<string, SysResponse<RoleDictionary>>(API.GET_CURRENT_ROLE + `/${familyId}`)
}

